﻿using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ///分割
            string province = "上海|北京|河南|四川";
            char[] f = new char[] { '|' };
            string[] area = province.Split(f);
            for (int i = 0; i < area.Length; i++)
            {
                Console.WriteLine(area[i]);
            }

            //一维数组
            int[] num = new int[5];
            for(int i=0;i<num.Length;i++)
            {
                Console.WriteLine(num[i]);//实例化但没有赋值，输出结果为5个0

            }
            //二维数组
            int[,] array = new int[3, 5]//三行五列
            {
            { 1,2,3,4,5},
            { 10,20,30,40,50},
            { 11,22,33,44,55}
            };
            Console.WriteLine(array[2,3]);//44

            //扩展
            Console.WriteLine("狼人杀游戏来啦，做好准备！！！");
            string[] roles = { "村民", "猎人", "预言家", "丘比特", "狼人", "女巫", "守卫\n" };
            Console.WriteLine("总共有{0}个角色",roles.Length);
            //循环法一：
            foreach (string role in roles)
            {
                Console.WriteLine(role);
            }
            //循环法二：
            for (int i = 0; i < roles.Length; i++)
            {
                Console.WriteLine(roles[i]);
            }
            Console.ReadKey();

        }
    }
}
